home *** CD-ROM | disk | FTP | other *** search
/ Power Bytes: Money & Finance / PowerBytes Money and Finance CD-ROM 01 / PowerBytes Money and Finance CD-ROM 01.iso / New Stuffed Files / Stock INVESTOR.sit / Stock INVESTOR / card_5291.txt < prev    next >
Encoding:
Text File  |  1988-10-18  |  30.8 KB  |  1,259 lines

  1. -- card: 5291 from stack: in
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 3723
  5. -- name: 
  6. ----- HyperTalk script -----
  7.  
  8.  
  9.  
  10.  
  11.  
  12. -- part 145 (field)
  13. -- low flags: 81
  14. -- high flags: 0007
  15. -- rect: left=63 top=34 right=314 bottom=504
  16. -- title width / last selected line: 0
  17. -- icon id / first selected line: 0 / 0
  18. -- text alignment: 0
  19. -- font id: 3
  20. -- text size: 10
  21. -- style flags: 0
  22. -- line height: 14
  23. -- part name: Help
  24. ----- HyperTalk script -----
  25. on mouseUp
  26.   hide card field "Help"
  27. end mouseUp
  28.  
  29.  
  30.  
  31. -- part 186 (button)
  32. -- low flags: 00
  33. -- high flags: 8004
  34. -- rect: left=410 top=321 right=340 bottom=455
  35. -- title width / last selected line: 0
  36. -- icon id / first selected line: 0 / 0
  37. -- text alignment: 1
  38. -- font id: 3
  39. -- text size: 9
  40. -- style flags: 0
  41. -- line height: 12
  42. -- part name: Chart
  43. ----- HyperTalk script -----
  44. on mouseUp
  45.  
  46.   ask "Enter data cells" with "A1:A5"
  47.   if it = "Cancel" then
  48.     exit mouseUp
  49.   end if
  50.  
  51.   put length of it into howLong
  52.  
  53.   if howLong = 5 then   --**two 1-digit cells**
  54.     put char 1 to 2 of it into firstCell
  55.     put char 4 to 5 of it into lastCell
  56.     put char 2 of firstCell into firstNum
  57.     put char 2 of lastCell into lastNum
  58.   else
  59.     if howLong = 6 then  --1-digit, 2-digit
  60.       put char 1 to 2 of it into firstCell
  61.       put char 4 to 6 of it into lastCell
  62.       put char 2 of firstCell into firstNum
  63.       put char 2 to 3 of lastCell into lastNum
  64.     else
  65.       if howLong = 7 then --two 2-digit cells
  66.         put char 1 to 3 of it into firstCell
  67.         put char 5 to 7 of it into lastCell
  68.         put char 2 to 3 of firstCell into firstNum
  69.         put char 2 to 3 of lastCell into lastNum
  70.       else
  71.         ask "Can't understand cells to chart. See 'Help'" with "Help"
  72.         if it = "Help" then
  73.           choose browse tool
  74.           click at 450,328
  75.           exit mouseUp
  76.         else
  77.           exit mouseUp
  78.         end if
  79.  
  80.       end if
  81.     end if
  82.   end if
  83.  
  84.   if firstNum > lastNum then
  85.     ask "You must enter cells in ascending order. See Help" with "Help"
  86.     if it = "Help" then
  87.       choose browse tool
  88.       click at 450, 328
  89.       exit mouseUp
  90.     else
  91.       exit mouseUp
  92.     end if
  93.   end if
  94.  
  95.   clearScreen
  96.   choose rect tool
  97.   set lineSize to 1
  98.   set filled to true
  99.   set pattern to 1
  100.   drag from 29,40 to 476,302
  101.  
  102.   --**get number of entries and entry width**--
  103.   if char 1 of firstCell <> char 1 of lastCell then
  104.     put ((Number of field lastCell - Number of field firstCell)/20) +1 into numEntries
  105.   else
  106.     put lastNum - firstNum +1 into numEntries
  107.   end if
  108.   put (430/numEntries) into entryWidth
  109.   put (430/numEntries)-10 into entryWidth1
  110.  
  111.   --**find scale for bars**--
  112.   put field firstCell into maxData
  113.   get Number of field firstCell
  114.   put it into cellNum
  115.   if char 1 of firstCell <> char 1 of lastCell then
  116.     repeat with x = 1 to numEntries
  117.       put max(maxData, field (cellNum +(20*x))) into maxData
  118.     end repeat
  119.   else
  120.     repeat with x = 1 to numEntries
  121.       put max(maxData, field (cellNum + x)) into maxData
  122.     end repeat
  123.   end if
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.   --**plot chart**--
  131.   choose rect tool
  132.   set pattern to 22
  133.  
  134.   if char 1 of firstCell <> char 1 of lastCell then
  135.     repeat with x = 0 to (numEntries-1)
  136.       put trunc (40 + (x * entrywidth)) into start
  137.       drag from start, 290 - (field (cellNum + (x*20)) / maxData) *240 to trunc (start + entryWidth1), 290
  138.     end repeat
  139.   else
  140.     repeat with x = 0 to (numEntries-1)
  141.       put trunc (40 + (x * entrywidth)) into start
  142.       drag from start, trunc (290 - (field (cellNum + x) / maxData)*240) to trunc (start + entryWidth1), 290
  143.     end repeat
  144.   end if
  145.  
  146.   repeat with x = 1 to 11
  147.     hide card button x
  148.   end repeat
  149.   show button "Clear Chart"
  150.   show button "Print Chart"
  151.   choose browse tool
  152. end mouseUp
  153.  
  154. on clearScreen
  155.   choose select tool
  156.   drag from 29, 40 to 476, 302
  157.   domenu "Clear Picture"
  158. end clearScreen
  159.  
  160.  
  161.  
  162.  
  163. -- part 187 (button)
  164. -- low flags: 00
  165. -- high flags: 8004
  166. -- rect: left=359 top=321 right=340 bottom=402
  167. -- title width / last selected line: 0
  168. -- icon id / first selected line: 0 / 0
  169. -- text alignment: 1
  170. -- font id: 3
  171. -- text size: 9
  172. -- style flags: 0
  173. -- line height: 12
  174. -- part name: Stats
  175. ----- HyperTalk script -----
  176. on mouseUp
  177.  
  178.   ask "What cells do you want to average?" with "A1:A10"
  179.   if it = "Cancel" then
  180.     exit mouseUp
  181.   end if
  182.  
  183.   --** get cells **--
  184.   put length of it into howLong
  185.   if howLong = 5 then   --**two 1-digit cells**
  186.     put char 1 to 2 of it into firstCell
  187.     put char 4 to 5 of it into lastCell
  188.     put char 2 of firstCell into firstNum
  189.     put char 2 of lastCell into lastNum
  190.   else
  191.     if howLong = 6 then  --1-digit, 2-digit
  192.       put char 1 to 2 of it into firstCell
  193.       put char 4 to 6 of it into lastCell
  194.       put char 2 of firstCell into firstNum
  195.       put char 2 to 3 of lastCell into lastNum
  196.     else
  197.       if howLong = 7 then --two 2-digit cells
  198.         put char 1 to 3 of it into firstCell
  199.         put char 5 to 7 of it into lastCell
  200.         put char 2 to 3 of firstCell into firstNum
  201.         put char 2 to 3 of lastCell into lastNum
  202.       else
  203.         ask "Can't understand cells to average. See 'Help'" with "Help"
  204.         if it = "Help" then
  205.           choose browse tool
  206.           click at 450,328
  207.           exit mouseUp
  208.         else
  209.           exit mouseUp
  210.         end if
  211.       end if
  212.     end if
  213.   end if
  214.  
  215.   if firstNum > lastNum then
  216.     ask "You must enter cells in ascending order. See Help" with "Help"
  217.     if it = "Help" then
  218.       choose browse tool
  219.       click at 450, 328
  220.       exit mouseUp
  221.     else
  222.       exit mouseUp
  223.     end if
  224.   end if
  225.  
  226.   --** put cells into data field **--
  227.   if char 1 of firstCell <> char 1 of lastCell then
  228.     put ((Number of field lastCell - Number of field firstCell)/20) +1 into numEntries
  229.     put (Number of field lastCell - Number of field firstCell)/20 into gap
  230.   else
  231.     put 1 into gap
  232.     put lastNum - firstNum +1 into numEntries
  233.   end if
  234.   put Number of field firstCell into cellCount
  235.  
  236.   repeat with c = 0 to (numEntries-1)
  237.     put field (cellCount + (c * gap)) into line (c+1) of field "data"
  238.   end repeat
  239.  
  240.  
  241.   --** find mean and standard deviation **--
  242.   put empty into sum
  243.   repeat with c = 1 to numEntries
  244.     add line c of field "data" to sum
  245.   end repeat
  246.   put sum/numEntries into mean
  247.  
  248.   put empty into sum
  249.   repeat with c = 1 to numEntries
  250.     add ((line c of field "data" - mean) * (line c of field "data" - mean)) to sum
  251.   end repeat
  252.   put sqrt(sum/(numEntries-1)) into SDev
  253.  
  254.  
  255.   --** find median and quartiles **--
  256.   if numEntries/2 = round(numEntries/2) then
  257.     put average(line numEntries/2 of field "data", line (numEntries/2)+1 of field "data") into median
  258.   else
  259.     put line round(numEntries/2) of field "data" into median
  260.   end if
  261.  
  262.   put average(line round(numEntries/4) of field "data", line round(numEntries/4)+1 of field "data") into loQuart
  263.   put average(line round(numEntries*(3/4)) of field "data", line round(numEntries*(3/4)+1) of field "data") into hiQuart
  264.  
  265.  
  266.   --** find mode **--
  267.   put empty into mode
  268.   put empty into oldCount
  269.   repeat with a = 1 to numEntries
  270.     get line a of field "data"
  271.     put it into datSearch
  272.     put 0 into count
  273.     repeat with b = 1 to numEntries
  274.       if datSearch = line b of field "data" then
  275.         put (count+1)  into count
  276.       end if
  277.     end repeat
  278.  
  279.     if count = oldCount then --search for multiple modes
  280.       if datSearch <> mode then
  281.         put "multiple" into mode
  282.       end if
  283.     end if
  284.  
  285.     if count > oldCount then --
  286.       put count into oldCount
  287.       if oldCount > 1 then
  288.         put datSearch into mode
  289.       else --no mode
  290.         put "-" into mode
  291.       end if
  292.     end if
  293.   end repeat
  294.  
  295.  
  296.  
  297.   --** output data **--
  298.   domenu "New Field"
  299.   set style of last card field to shadow
  300.   set name of last card field to "new"
  301.   set rect of card field "new" to 126,103,426,248
  302.   set textSize of card field "new" to 12
  303.   set textAlign of card field "new" to left
  304.   set textFont of card field "new" to chicago
  305.   put "Mean = "&& mean into line 2 of card field "new"
  306.   put "     Standard Deviation = " && SDEV into line 3 of card field "new"
  307.   put "Median = " && median into line 4 of card field "new"
  308.   put "     Upper Quartile = " && hiQuart into line 5 of card field "new"
  309.   put "     Lower Quartile = " && loQuart into line 6 of card field "new"
  310.   put "Mode = " && mode into line 7 of card field "new"
  311.   choose browse tool
  312.   put empty into field "data"
  313. end mouseUp
  314.  
  315.  
  316.  
  317. -- part 188 (button)
  318. -- low flags: 00
  319. -- high flags: 8004
  320. -- rect: left=116 top=321 right=341 bottom=150
  321. -- title width / last selected line: 0
  322. -- icon id / first selected line: 0 / 0
  323. -- text alignment: 1
  324. -- font id: 3
  325. -- text size: 9
  326. -- style flags: 0
  327. -- line height: 12
  328. -- part name: NPV
  329. ----- HyperTalk script -----
  330. on mouseUp
  331.   ask "Enter cell range of cash flows" with "A1:A10"
  332.   if it = "Cancel" then
  333.     exit mouseUp
  334.   end if
  335.  
  336.   --** get cells **--
  337.   put length of it into howLong
  338.   if howLong = 5 then   --**two 1-digit cells**
  339.     put char 1 to 2 of it into firstCell
  340.     put char 4 to 5 of it into lastCell
  341.     put char 2 of firstCell into firstNum
  342.     put char 2 of lastCell into lastNum
  343.   else
  344.     if howLong = 6 then  --1-digit, 2-digit
  345.       put char 1 to 2 of it into firstCell
  346.       put char 4 to 6 of it into lastCell
  347.       put char 2 of firstCell into firstNum
  348.       put char 2 to 3 of lastCell into lastNum
  349.     else
  350.       if howLong = 7 then --two 2-digit cells
  351.         put char 1 to 3 of it into firstCell
  352.         put char 5 to 7 of it into lastCell
  353.         put char 2 to 3 of firstCell into firstNum
  354.         put char 2 to 3 of lastCell into lastNum
  355.       else
  356.         ask "Can't understand cash flowcells.   See 'Help'" with "Help"
  357.         if it = "Help" then
  358.           choose browse tool
  359.           click at 450,328
  360.           exit mouseUp
  361.         else
  362.           exit mouseUp
  363.         end if
  364.       end if
  365.     end if
  366.   end if
  367.  
  368.   if firstNum > lastNum then
  369.     ask "You must enter cells in ascending order. See Help" with "Help"
  370.     if it = "Help" then
  371.       choose browse tool
  372.       click at 450, 328
  373.       exit mouseUp
  374.     else
  375.       exit mouseUp
  376.     end if
  377.   end if
  378.  
  379.   --** put cells in data field **--
  380.   if char 1 of firstCell <> char 1 of lastCell then
  381.     put ((Number of field lastCell - Number of field firstCell)/20) +1 into numEntries
  382.     put (Number of field lastCell - Number of field firstCell)/20 into gap
  383.   else
  384.     put 1 into gap
  385.     put lastNum - firstNum +1 into numEntries
  386.   end if
  387.   put Number of field firstCell into cellCount
  388.  
  389.   repeat with c = 0 to (numEntries-1)
  390.     put field (cellCount + (c * gap)) into line (c+1) of field "data"
  391.   end repeat
  392.  
  393.   --** get interest rate **--
  394.   ask "Enter Interest Rate as a decimal"
  395.   put it into r
  396.  
  397.   --** determine Net Present Value **--
  398.   put empty into NPV
  399.   repeat with t = 2 to numEntries
  400.     get line t of field "data"
  401.     put 1 into x
  402.     repeat with c = 1 to (t-1)
  403.       put x * (1+r) into x
  404.     end repeat
  405.     add it/x to NPV
  406.   end repeat
  407.   add line 1 of field "data" to NPV --deduct initial cost
  408.  
  409.   --** output data **--
  410.   put "Net Present Value = " && NPV into msg
  411.   put empty into field "data"
  412. end mouseUp
  413.  
  414.  
  415.  
  416. -- part 189 (button)
  417. -- low flags: 00
  418. -- high flags: 8004
  419. -- rect: left=156 top=321 right=340 bottom=190
  420. -- title width / last selected line: 0
  421. -- icon id / first selected line: 0 / 0
  422. -- text alignment: 1
  423. -- font id: 3
  424. -- text size: 9
  425. -- style flags: 0
  426. -- line height: 12
  427. -- part name: %╞
  428. ----- HyperTalk script -----
  429. on mouseUp
  430.   ask "Enter first array of cells" with "A1:A10"
  431.  
  432.   put length of it into howLong
  433.   if howLong = 5 then   --**two 1-digit cells**
  434.     put char 1 to 2 of it into firstCell
  435.     put char 4 to 5 of it into lastCell
  436.     put char 2 of firstCell into firstNum
  437.     put char 2 of lastCell into lastNum
  438.   else
  439.     if howLong = 6 then  --1-digit, 2-digit
  440.       put char 1 to 2 of it into firstCell
  441.       put char 4 to 6 of it into lastCell
  442.       put char 2 of firstCell into firstNum
  443.       put char 2 to 3 of lastCell into lastNum
  444.     else
  445.       if howLong = 7 then --two 2-digit cells
  446.         put char 1 to 3 of it into firstCell
  447.         put char 5 to 7 of it into lastCell
  448.         put char 2 to 3 of firstCell into firstNum
  449.         put char 2 to 3 of lastCell into lastNum
  450.       end if
  451.     end if
  452.   end if
  453.  
  454.   --** put cells in data field **--
  455.   if char 1 of firstCell <> char 1 of lastCell then
  456.     put ((Number of field lastCell - Number of field firstCell)/20) +1 into numEntries
  457.     put (Number of field lastCell - Number of field firstCell)/20 into gap
  458.   else
  459.     put 1 into gap
  460.     put lastNum - firstNum +1 into numEntries
  461.   end if
  462.   put Number of field firstCell into cellCount
  463.  
  464.   repeat with c = 0 to (numEntries-1)
  465.     put field (cellCount + (c * gap)) into item 1 of line (c+1) of field "data"
  466.   end repeat
  467.  
  468.   ask "Enter second array of cells" with "B1:B10"
  469.   if howLong = 5 then   --**two 1-digit cells**
  470.     put char 1 to 2 of it into firstCell
  471.     put char 4 to 5 of it into lastCell
  472.     put char 2 of firstCell into firstNum
  473.     put char 2 of lastCell into lastNum
  474.   else
  475.     if howLong = 6 then  --1-digit, 2-digit
  476.       put char 1 to 2 of it into firstCell
  477.       put char 4 to 6 of it into lastCell
  478.       put char 2 of firstCell into firstNum
  479.       put char 2 to 3 of lastCell into lastNum
  480.     else
  481.       if howLong = 7 then --two 2-digit cells
  482.         put char 1 to 3 of it into firstCell
  483.         put char 5 to 7 of it into lastCell
  484.         put char 2 to 3 of firstCell into firstNum
  485.         put char 2 to 3 of lastCell into lastNum
  486.       end if
  487.     end if
  488.   end if
  489.  
  490.   --** put cells in data field **--
  491.   if char 1 of firstCell <> char 1 of lastCell then
  492.     put ((Number of field lastCell - Number of field firstCell)/20) +1 into numEntries
  493.     put (Number of field lastCell - Number of field firstCell)/20 into gap
  494.   else
  495.     put 1 into gap
  496.     put lastNum - firstNum +1 into numEntries
  497.   end if
  498.   put Number of field firstCell into cellCount
  499.  
  500.   repeat with c = 0 to (numEntries-1)
  501.     put field (cellCount + (c * gap)) into item 2 of line (c+1) of field "data"
  502.   end repeat
  503.  
  504.   --** creat output field **--
  505.   domenu "New field"
  506.   set name of last card field to "Result"
  507.   set rect of card field "Result" to 189,33,253,312
  508.   set style of card field "Result" to rect
  509.   set textSize of card field "Result" to 10
  510.  
  511.   --** calculate Percent Change **--
  512.   repeat with c = 1 to numEntries
  513.     put (item 1 of line c of field "data" - item 2 of line c of field "data")/item 1 of line c of field "data" into change
  514.     put change * 100 into change
  515.  
  516.     --** output data **--
  517.     if change > 0 then
  518.       put "+" && change && "%" into line c of card field "Result"
  519.     else
  520.       if change < 0 then
  521.         put change && "%" into line c of card field "Result"
  522.       else
  523.         put "0%" into line c of card field "Result"
  524.       end if
  525.     end if
  526.   end repeat
  527.   put empty into field "data"
  528.   choose browse tool
  529. end mouseUp
  530.  
  531.  
  532.  
  533. -- part 190 (button)
  534. -- low flags: 00
  535. -- high flags: 8004
  536. -- rect: left=318 top=321 right=340 bottom=353
  537. -- title width / last selected line: 0
  538. -- icon id / first selected line: 0 / 0
  539. -- text alignment: 1
  540. -- font id: 3
  541. -- text size: 9
  542. -- style flags: 0
  543. -- line height: 12
  544. -- part name: Clear
  545. ----- HyperTalk script -----
  546. on mouseUp
  547.   repeat with c = 1 to 140
  548.     put empty into field c
  549.   end repeat
  550. end mouseUp
  551.  
  552.  
  553.  
  554. -- part 191 (button)
  555. -- low flags: 00
  556. -- high flags: 8004
  557. -- rect: left=196 top=321 right=340 bottom=257
  558. -- title width / last selected line: 0
  559. -- icon id / first selected line: 0 / 0
  560. -- text alignment: 1
  561. -- font id: 3
  562. -- text size: 9
  563. -- style flags: 0
  564. -- line height: 12
  565. -- part name: Paste Table
  566. ----- HyperTalk script -----
  567. on mouseUp
  568.   put empty into field tableData
  569.   show field tableData
  570.   choose browse tool
  571.   click at 66,35
  572.   domenu "Paste Text"
  573.   put number of lines of field tableData into rows
  574.   if rows > 20 then
  575.     answer "Too many rows of data" with OK
  576.     hide field tableData
  577.     exit mouseUp
  578.   end if
  579.  
  580.   answer "How are data separated?" with "Spaces" or "Commas"
  581.   if it = "Spaces" then
  582.     repeat with x = 1 to rows
  583.       put 1 into y
  584.       repeat for (number of characters in line x of field "tableData")
  585.         if char y of line x of field "tableData" = " " then
  586.           put "," into char y of line x of field "tableData"
  587.           add 2 to y
  588.         else
  589.           add 1 to y
  590.         end if
  591.       end repeat
  592.     end repeat
  593.   end if
  594.  
  595.   repeat with c = 1 to rows
  596.     put number of items in line c of field tableData into cols
  597.     if cols > 7 then
  598.       answer "Too many columns of data" with OK
  599.       hide field tableData
  600.       exit mouseUp
  601.     end if
  602.     repeat with d = 1 to cols
  603.       put item d of line c of field tableData into field (c + (20*(d-1)))
  604.     end repeat
  605.   end repeat
  606.   hide field tableData
  607.   choose browse tool
  608. end mouseUp
  609.  
  610.  
  611.  
  612. -- part 192 (button)
  613. -- low flags: 00
  614. -- high flags: 8004
  615. -- rect: left=260 top=321 right=340 bottom=316
  616. -- title width / last selected line: 0
  617. -- icon id / first selected line: 0 / 0
  618. -- text alignment: 1
  619. -- font id: 3
  620. -- text size: 9
  621. -- style flags: 0
  622. -- line height: 12
  623. -- part name: + Row/Col
  624. ----- HyperTalk script -----
  625. on mouseUp
  626.   ask "What cells do you want to add?" with "A1:A10"
  627.   if it = "Cancel" then
  628.     exit mouseUp
  629.   end if
  630.  
  631.   put length of it into howLong
  632.  
  633.   if howLong = 5 then   --**two 1-digit cells**
  634.     put char 1 to 2 of it into firstCell
  635.     put char 4 to 5 of it into lastCell
  636.     put char 2 of firstCell into firstNum
  637.     put char 2 of lastCell into lastNum
  638.   else
  639.     if howLong = 6 then  --1-digit, 2-digit
  640.       put char 1 to 2 of it into firstCell
  641.       put char 4 to 6 of it into lastCell
  642.       put char 2 of firstCell into firstNum
  643.       put char 2 to 3 of lastCell into lastNum
  644.     else
  645.       if howLong = 7 then --two 2-digit cells
  646.         put char 1 to 3 of it into firstCell
  647.         put char 5 to 7 of it into lastCell
  648.         put char 2 to 3 of firstCell into firstNum
  649.         put char 2 to 3 of lastCell into lastNum
  650.       else
  651.         ask "Can't understand cells to add.   See 'Help'" with "Help"
  652.         if it = "Help" then
  653.           choose browse tool
  654.           click at 450,328
  655.           exit mouseUp
  656.         else
  657.           exit mouseUp
  658.         end if
  659.  
  660.       end if
  661.     end if
  662.   end if
  663.  
  664.   if firstNum > lastNum then
  665.     ask "You must enter cells in ascending order. See Help" with "Help"
  666.     if it = "Help" then
  667.       choose browse tool
  668.       click at 450, 328
  669.       exit mouseUp
  670.     else
  671.       exit mouseUp
  672.     end if
  673.   end if
  674.  
  675.   ask "Where do you want result?" with "New Field"
  676.   if it = "Cancel" then
  677.     exit mouseUp
  678.   end if
  679.  
  680.   if it = "New Field" then
  681.     domenu "New Field"
  682.     set style of last field to rect
  683.     set name of last field to Total
  684.     set rect of field "Total" to 215, 140, 300, 152
  685.     set textSize of field "Total" to 9
  686.     set textAlign of field "Total" to center
  687.     put "Total" into totalCell
  688.   else
  689.     put it into totalCell
  690.   end if
  691.   put empty into sum
  692.   get Number of field firstCell
  693.   put it into cellNum
  694.  
  695.   if char 1 of firstCell <> char 1 of lastCell then
  696.     repeat with x = 0 to ((Number of field lastCell - Number of field firstCell)/20)
  697.       add field (cellNum + (x*20)) to sum
  698.     end repeat
  699.   end if
  700.  
  701.   if char 1 of firstCell = char 1 of lastCell then
  702.     repeat with x = 0 to (lastNum - firstNum)
  703.       add field (cellNum + x) to sum
  704.     end repeat
  705.   end if
  706.  
  707.   put sum into field totalCell
  708.   choose browse tool
  709. end mouseUp
  710.  
  711.  
  712.  
  713.  
  714.  
  715. -- part 193 (button)
  716. -- low flags: 00
  717. -- high flags: 8004
  718. -- rect: left=6 top=321 right=340 bottom=29
  719. -- title width / last selected line: 0
  720. -- icon id / first selected line: 0 / 0
  721. -- text alignment: 1
  722. -- font id: 0
  723. -- text size: 12
  724. -- style flags: 0
  725. -- line height: 16
  726. -- part name: +
  727. ----- HyperTalk script -----
  728. on mouseUp
  729.   ask " " with "Enter Cell"
  730.   if it <> "Enter Cell" then
  731.     put field it into x
  732.   end if
  733.   repeat while it <> "Enter Cell"
  734.     ask "+" with "Enter Cell"
  735.     if it = "Enter Cell" then exit repeat
  736.     put field it + x into x
  737.   end repeat
  738.   put x into msg
  739. end mouseUp
  740.  
  741.  
  742.  
  743. -- part 194 (button)
  744. -- low flags: 00
  745. -- high flags: 8004
  746. -- rect: left=35 top=321 right=340 bottom=58
  747. -- title width / last selected line: 0
  748. -- icon id / first selected line: 0 / 0
  749. -- text alignment: 1
  750. -- font id: 0
  751. -- text size: 12
  752. -- style flags: 256
  753. -- line height: 16
  754. -- part name: -
  755. ----- HyperTalk script -----
  756. on mouseUp
  757.   ask " " with "Enter Cell"
  758.   put field it into cell1
  759.   ask "-" with "Enter Cell"
  760.   put cell1 - field it into msg
  761.  
  762. end mouseUp
  763.  
  764.  
  765.  
  766. -- part 195 (button)
  767. -- low flags: 00
  768. -- high flags: 8004
  769. -- rect: left=62 top=321 right=340 bottom=85
  770. -- title width / last selected line: 0
  771. -- icon id / first selected line: 0 / 0
  772. -- text alignment: 1
  773. -- font id: 0
  774. -- text size: 12
  775. -- style flags: 0
  776. -- line height: 16
  777. -- part name: *
  778. ----- HyperTalk script -----
  779. on mouseUp
  780.   ask " " with "Enter Cell"
  781.   if it <> "Enter Cell" then
  782.     put field it into x
  783.   end if
  784.   repeat while it <> "Enter Cell"
  785.     ask " " with "Enter Cell"
  786.     if it = "Enter Cell" then exit repeat
  787.     put field it * x into x
  788.   end repeat
  789.   put x into msg
  790.  
  791. end mouseUp
  792.  
  793.  
  794.  
  795. -- part 196 (button)
  796. -- low flags: 00
  797. -- high flags: 8004
  798. -- rect: left=89 top=321 right=340 bottom=112
  799. -- title width / last selected line: 0
  800. -- icon id / first selected line: 0 / 0
  801. -- text alignment: 1
  802. -- font id: 0
  803. -- text size: 12
  804. -- style flags: 0
  805. -- line height: 16
  806. -- part name: ╓
  807. ----- HyperTalk script -----
  808. on mouseUp
  809.   ask " " with "Enter Cell"
  810.   put field it into cell1
  811.   ask "├╖" with "Enter Cell"
  812.   put cell1 / field it into msg
  813. end mouseUp
  814.  
  815.  
  816.  
  817. -- part 197 (button)
  818. -- low flags: 00
  819. -- high flags: 8004
  820. -- rect: left=462 top=321 right=340 bottom=503
  821. -- title width / last selected line: 0
  822. -- icon id / first selected line: 0 / 0
  823. -- text alignment: 1
  824. -- font id: 3
  825. -- text size: 9
  826. -- style flags: 0
  827. -- line height: 12
  828. -- part name: Help
  829. ----- HyperTalk script -----
  830. on mouseUp
  831.   show card field "Help"
  832. end mouseUp
  833.  
  834.  
  835.  
  836. -- part 202 (button)
  837. -- low flags: 80
  838. -- high flags: 8004
  839. -- rect: left=6 top=321 right=340 bottom=70
  840. -- title width / last selected line: 0
  841. -- icon id / first selected line: 0 / 0
  842. -- text alignment: 1
  843. -- font id: 3
  844. -- text size: 9
  845. -- style flags: 0
  846. -- line height: 12
  847. -- part name: Print Chart
  848. ----- HyperTalk script -----
  849. on mouseUp
  850.   domenu "Print Card"
  851. end mouseUp
  852.  
  853.  
  854.  
  855. -- part 203 (button)
  856. -- low flags: 80
  857. -- high flags: 8004
  858. -- rect: left=224 top=321 right=340 bottom=288
  859. -- title width / last selected line: 0
  860. -- icon id / first selected line: 0 / 0
  861. -- text alignment: 1
  862. -- font id: 3
  863. -- text size: 9
  864. -- style flags: 0
  865. -- line height: 12
  866. -- part name: Clear Chart
  867. ----- HyperTalk script -----
  868. on mouseUp
  869.   clearScreen
  870.   hide card button "Print Chart"
  871.   hide card button "Clear Chart"
  872.   repeat with x = 1 to 11
  873.     show card button x
  874.   end repeat
  875.   choose browse tool
  876. end mouseUp
  877.  
  878. on clearScreen
  879.   choose select tool
  880.   drag from 29, 40 to 476, 302
  881.   domenu "Clear Picture"
  882. end clearScreen
  883.  
  884.  
  885. -- part contents for card part 145
  886. ----- text -----
  887.                    ┬á┬á┬á┬á┬á┬á┬á┬á┬á┬á┬á┬á            SPREAD
  888.                              ┬á┬á┬á┬á┬á┬á┬á┬á┬á┬á┬á┬á      by 
  889.           ┬á┬á┬á┬á┬á┬á┬á┬á┬á┬á┬á┬á┬á                Maria Lima
  890.  
  891. This is a developmental copy of SPREAD,a  spreadsheet designed as a single HyperCard card.  It can be pasted into any stack, and accessed as needed.  For protected stacks, its best to leave SPREAD as a separate stack and attach a button to access it.  That way you can manipulate the scripts as needed to perform customized functions without changing the access level.  If you are interested in the completed version of SPREAD, or have any suggestions or problems, please contact me.  
  892. The address (if you've lost it from the shareware notice) is:  
  893. Maria Lima, 5110 Frich Drive, Pgh., PA  15227.
  894.  
  895. You can easily perform any of the following functions with SPREAD:
  896.  
  897. Addition - to add consecutive cells in a column or row, press "+ Row/Col" and enter the first and last cell to be added, separated by a colon.  (e.g. A1:A10).  Sum can be placed into a cell or into a new card field.
  898. To add nonconsecutive cells or cells of different rows and columns, use the "+" button.Enter cell numbers at prompt.  When finished, hit return with "Enter Cell" still in window.  Sum will appear in message box.
  899.  
  900. Subtraction - use "-" button.  Enter number of first cell at prompt, return, then enter number of cell to be subtracted, return.  Result will appear in message box.
  901.  
  902. Multiplication - use "x" button.  Enter cell numbers to be multiplied at prompt.  When finished, hit return with "Enter Cell" still in window.  Product will appear in message box.
  903.  
  904. Division - use "├╖" button.  Enter number of cell to be divided, return, then enter number of divisor.  Result will appear in message box.
  905.  
  906. NPV - calcualtes the Net Present Value for a series of cash flows and places the result in the message box.  Enter cells containing net cash flows for consecutive periods in the usual A1:A10 format.   Negative flows should be designated with a "-" sign, but no "$" or commas should be included.  The first cell is considered period 0, an immediate expenditure.
  907.  
  908. %Γêå - calculates the percentage change for a series of data.  Data may be entered from rows or columns, but output will be displayed in a new field in columnar format.
  909.  
  910. Paste Table:  enables you to paste in a table of figures from HyperCard fields or other documents into the spreadsheet cells.  Copy the table, press the button, then specify if data are separated by commas or spaces.  Data will be placed beginning in cell A1.  Table can be no larger than 7 columns and/or 20 rows.
  911.  
  912. Clear:  clears all spreadsheet cells
  913.  
  914. Stats:  calculates the mean, median, mode, standard deviation and quartiles for specified data.
  915.  
  916. Chart:  plots a bar chart of data in a row or column.  Specify data cells in the usual A1:A10 format at prompt.
  917.  
  918. SPREAD is not a replacement for a full spreadsheet.  If you have an Excel-size job 
  919. (i.e. large mass of data to enter, complex calculations, etc.) you would be better off accessing your regular spreadsheet program through a Hypercard script.  But if you only need a few columns, SPREAD is for you.    
  920.  
  921.  
  922.  
  923. -- part contents for card part 1
  924. ----- text -----
  925. 30
  926.  
  927. -- part contents for card part 21
  928. ----- text -----
  929. 10
  930.  
  931.  
  932. -- part contents for card part 42
  933. ----- text -----
  934. 5
  935.  
  936. -- part contents for card part 62
  937. ----- text -----
  938. 5
  939.  
  940. -- part contents for card part 102
  941. ----- text -----
  942. 50
  943.  
  944. -- part contents for card part 82
  945. ----- text -----
  946. 0
  947.  
  948. -- part contents for card part 2
  949. ----- text -----
  950. 10
  951.  
  952. -- part contents for card part 3
  953. ----- text -----
  954. 5
  955.  
  956. -- part contents for card part 4
  957. ----- text -----
  958. 5
  959.  
  960. -- part contents for card part 6
  961. ----- text -----
  962. 50
  963.  
  964. -- part contents for card part 5
  965. ----- text -----
  966. 0
  967.  
  968. -- part contents for card part 7
  969. ----- text -----
  970. 10
  971.  
  972. -- part contents for card part 122
  973. ----- text -----
  974. 10
  975.  
  976. -- part contents for card part 24
  977. ----- text -----
  978. Test Stack
  979.  
  980. -- part contents for card part 25
  981. ----- text -----
  982. Only
  983.  
  984. -- part contents for background part 1
  985. ----- text -----
  986. 5
  987.  
  988. -- part contents for background part 2
  989. ----- text -----
  990. 60
  991.  
  992. -- part contents for background part 3
  993. ----- text -----
  994. 5
  995.  
  996. -- part contents for background part 4
  997. ----- text -----
  998. 10
  999.  
  1000.  
  1001. -- part contents for background part 6
  1002. ----- text -----
  1003. 10
  1004.  
  1005. -- part contents for background part 5
  1006. ----- text -----
  1007. 0
  1008.  
  1009. -- part contents for background part 21
  1010. ----- text -----
  1011. 10
  1012.  
  1013. -- part contents for background part 41
  1014. ----- text -----
  1015. 5
  1016.  
  1017. -- part contents for background part 61
  1018. ----- text -----
  1019. 40
  1020.  
  1021. -- part contents for background part 81
  1022. ----- text -----
  1023. 10
  1024.  
  1025. -- part contents for background part 101
  1026. ----- text -----
  1027. 10
  1028.  
  1029. -- part contents for background part 145
  1030. ----- text -----
  1031. 5
  1032. 60
  1033. 5
  1034. 10
  1035. 0
  1036. 10
  1037. 0
  1038. 0
  1039. 0
  1040. 0
  1041. 0
  1042. 0
  1043. 0
  1044. 0
  1045. 0
  1046. 0
  1047. 0
  1048. 0
  1049. 0
  1050. 0
  1051. 0
  1052. 0
  1053. 0
  1054. 0
  1055. 0
  1056. 9
  1057. 30
  1058.  
  1059. -- part contents for card part 161
  1060. ----- text -----
  1061.  
  1062. Mean =  7 Standard Deviation =  1.581139
  1063. Median =  6 Upper Quartile =  8.5
  1064.  
  1065. -- part contents for card part 163
  1066. ----- text -----
  1067.  
  1068. Mean =  7 Standard Deviation =  1.581139
  1069. Median =  6 Upper Quartile =  8.5
  1070.              Lower Quartile =  5.5
  1071. Mode =  5
  1072.  
  1073. -- part contents for card part 164
  1074. ----- text -----
  1075.  
  1076. Mean =  7 Standard Deviation =  1.581139
  1077. Median =  6 Upper Quartile =  8.5
  1078.              Lower Quartile =  5.5
  1079. Mode =  5
  1080.  
  1081. -- part contents for card part 165
  1082. ----- text -----
  1083.  
  1084. Mean =  7
  1085.      Standard Deviation =  1.581139
  1086. Median =  6
  1087.      Upper Quartile =  8.5
  1088.      Lower Quartile =  5.5
  1089. Mode =  5
  1090.  
  1091. -- part contents for card part 166
  1092. ----- text -----
  1093.  
  1094. Mean =  17.5
  1095.      Standard Deviation =  9.354143
  1096. Median =  17.5
  1097.      Upper Quartile =  25
  1098.      Lower Quartile =  12.5
  1099. Mode =  5
  1100.  
  1101. -- part contents for card part 167
  1102. ----- text -----
  1103.  
  1104. Mean =  17.5
  1105.      Standard Deviation =  9.354143
  1106. Median =  17.5
  1107.      Upper Quartile =  25
  1108.      Lower Quartile =  12.5
  1109. Mode =  multiple
  1110.  
  1111. -- part contents for card part 168
  1112. ----- text -----
  1113.  
  1114. Mean =  7
  1115.      Standard Deviation =  1.581139
  1116. Median =  6
  1117.      Upper Quartile =  8.5
  1118.      Lower Quartile =  5.5
  1119. Mode =  -
  1120.  
  1121. -- part contents for card part 169
  1122. ----- text -----
  1123.  
  1124. Mean =  7
  1125.      Standard Deviation =  1.581139
  1126. Median =  6
  1127.      Upper Quartile =  8.5
  1128.      Lower Quartile =  5.5
  1129. Mode =  multiple
  1130.  
  1131. -- part contents for card part 170
  1132. ----- text -----
  1133.  
  1134. Mean =  7
  1135.      Standard Deviation =  1.581139
  1136. Median =  6
  1137.      Upper Quartile =  8.5
  1138.      Lower Quartile =  5.5
  1139. Mode =  multiple
  1140.  
  1141. -- part contents for card part 171
  1142. ----- text -----
  1143.  
  1144. Mean =  16
  1145.      Standard Deviation =  24.849547
  1146. Median =  60
  1147.      Upper Quartile =  5
  1148.      Lower Quartile =  32.5
  1149. Mode =  multiple
  1150.  
  1151. -- part contents for card part 172
  1152. ----- text -----
  1153.  
  1154. Mean =  16
  1155.      Standard Deviation =  24.849547
  1156. Median =  60
  1157.      Upper Quartile =  5
  1158.      Lower Quartile =  32.5
  1159. Mode =  multiple oldCount  1
  1160.  
  1161. -- part contents for card part 173
  1162. ----- text -----
  1163.  
  1164. Mean =  16
  1165.      Standard Deviation =  24.849547
  1166. Median =  60
  1167.      Upper Quartile =  5
  1168.      Lower Quartile =  32.5
  1169. Mode =  multiple oldCount  1
  1170.  
  1171. -- part contents for card part 174
  1172. ----- text -----
  1173.  
  1174. Mean =  16
  1175.      Standard Deviation =  24.849547
  1176. Median =  60
  1177.      Upper Quartile =  5
  1178.      Lower Quartile =  32.5
  1179. Mode =  multiple oldCount  1
  1180.  
  1181. -- part contents for card part 175
  1182. ----- text -----
  1183.  
  1184. Mean =  16
  1185.      Standard Deviation =  24.849547
  1186. Median =  60
  1187.      Upper Quartile =  5
  1188.      Lower Quartile =  32.5
  1189. Mode =  multiple oldCount  1
  1190.  
  1191. -- part contents for card part 176
  1192. ----- text -----
  1193.  
  1194. Mean =  16
  1195.      Standard Deviation =  24.849547
  1196. Median =  60
  1197.      Upper Quartile =  5
  1198.      Lower Quartile =  32.5
  1199. Mode =  multiple oldCount  1
  1200.  
  1201. -- part contents for card part 177
  1202. ----- text -----
  1203.  
  1204. Mean =  16
  1205.      Standard Deviation =  24.849547
  1206. Median =  60
  1207.      Upper Quartile =  5
  1208.      Lower Quartile =  32.5
  1209. Mode =  multiple oldCount  1
  1210.  
  1211. -- part contents for card part 178
  1212. ----- text -----
  1213.  
  1214. Mean =  16
  1215.      Standard Deviation =  24.849547
  1216. Median =  60
  1217.      Upper Quartile =  5
  1218.      Lower Quartile =  32.5
  1219. Mode =  multiple oldCount  1
  1220.  
  1221. -- part contents for card part 179
  1222. ----- text -----
  1223.  
  1224. Mean =  16
  1225.      Standard Deviation =  24.849547
  1226. Median =  60
  1227.      Upper Quartile =  5
  1228.      Lower Quartile =  32.5
  1229. Mode =  multiple oldCount  1
  1230.  
  1231. -- part contents for card part 180
  1232. ----- text -----
  1233.  
  1234. Mean =  16
  1235.      Standard Deviation =  24.849547
  1236. Median =  60
  1237.      Upper Quartile =  5
  1238.      Lower Quartile =  32.5
  1239. Mode =  multiple oldCount  1
  1240.  
  1241. -- part contents for card part 181
  1242. ----- text -----
  1243.  
  1244. Mean =  16
  1245.      Standard Deviation =  24.849547
  1246. Median =  60
  1247.      Upper Quartile =  5
  1248.      Lower Quartile =  32.5
  1249. Mode =  5 oldCount  1
  1250.  
  1251. -- part contents for card part 182
  1252. ----- text -----
  1253.  
  1254. Mean =  15
  1255.      Standard Deviation =  22.36068
  1256. Median =  7.5
  1257.      Upper Quartile =  10
  1258.      Lower Quartile =  32.5
  1259. Mode =  multiple